
import importlib
import os
class Common:
    @staticmethod
    def reload_script(graph):
        print("reload_script...")
        cls_list = []
        files = os.listdir("plugins")
        for file in files:
            if not file.endswith(".py"):
                continue
            file = file.replace(".py", "")
            module_node = importlib.import_module("plugins.{}".format(file))
            class_name = module_node.getClassName()
            print(module_node.getClassName())
            cls = getattr(module_node, class_name)
            cls_list.append(cls)
        graph.register_nodes(cls_list)
